import Vue from 'vue';
import Vuex from 'vuex';
import store from 'store';
import getters from './getters';
import mutations from './mutations';
import actions from './actions';

Vue.use(Vuex);
// const defautCity = getStore('defautCity');

const state = {
    accountInfo: null, // 用户信息,
};


const storeState = vuexStore => {
    vuexStore.subscribe((mutation) => {
        if (mutation.type === 'ACCOUNTSIGNIN') {
            store.set('ACCOUNTSIGNIN', mutation.payload);
        }
    });
};

export default new Vuex.Store({
    state,
    getters,
    actions,
    mutations,
    plugins: [storeState],
});
